package com.ymatou.iapi.trading.sellerquery2.testcase;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.seller.trading.api.parameter.GetOrderListByOrderIdListBean;
import com.ymatou.query.seller.trading.api.parameter.OrderEntities;
import com.ymatou.query.seller.trading.api.parameter.OrderInfo;
import com.ymatou.query.seller.trading.api.parameter.Ymt_O_OrderNote;
import com.ymatou.query.seller.trading.api.parameter.Ymt_Order;
import com.ymatou.query.seller.trading.api.parameter.Ymt_OrderInfo;
import com.ymatou.query.seller.trading.api.parameter.Ymt_OrderState;
import com.ymatou.query.seller.trading.api.parameter.Ymt_OrderSummary;
import com.ymatou.query.seller.trading.api.parameter.resp.GetOrderListByOrderIdListResponse;
import com.ymatou.query.seller.trading.api.parameter.sp.Sp_GetOrderListByOrderIdList;
import com.ymatou.query.seller.trading.api.service.OrderCreate;
import com.ymatou.query.trading.api.parameter.OrderConverter;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.common.entitie.OrderItemInfo;
import com.ymttest.common.entitie.OrderItemInfoExt;
import com.ymttest.common.entitie.OrderSummary;
import com.ymttest.common.order.sellerquery2.Common;
import com.ymttest.database.model.ProductPromotion;
import com.ymttest.database.model.Ymt_Bill;
import com.ymttest.database.model.Ymt_CreditDetail;
import com.ymttest.database.model.Ymt_OrderExt;
import com.ymttest.database.model.Ymt_OrderPostPay;
import com.ymttest.database.model.Ymt_OrderToBill;
import com.ymttest.database.model.Ymt_Order_Frozen;
import com.ymttest.database.model.Ymt_TradingItem;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.constant.ECode;

public class Ts_GetOrderListByOrderIdList {
	private static GetOrderListByOrderIdListBean request;
	// private static
	// com.ymatou.query.seller.trading.api.service.GetOrderListByOrderIdListCall
	// call;
	private static com.ymatou.iapi.trading.sellerquery2.service.GetOrderListByOrderIdListCall call;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("根据订单id列表获取订单列表");
	}

	@Before
	public void caseUp() {
		request = new GetOrderListByOrderIdListBean();
		// call = new
		// com.ymatou.query.seller.trading.api.service.GetOrderListByOrderIdListCall();
		call = new com.ymatou.iapi.trading.sellerquery2.service.GetOrderListByOrderIdListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	protected void ConstructResponse(GetOrderListByOrderIdListResponse response) {
		Sp_GetOrderListByOrderIdList sp = new Sp_GetOrderListByOrderIdList();
		sp.setSellerId(request.getSellerId());
		sp.setOrderIds(request.getOrderIdList());
		sp.execute();
		OrderEntities result = ConvertResult(sp);
		response.setOrderInfoList(OrderConverter.AsOrderInfos(result, true));
		changeSalesRefundStatus(response);
	}
	
	protected void changeSalesRefundStatus(GetOrderListByOrderIdListResponse response){
		if (!DataUtil.isNullOrEmpty(response.getOrderInfoList())) {
			int[] orderIds = response.getOrderInfoList().stream().mapToInt(x->x.getOrderId()).toArray();
			Map<Integer,Integer> ordersRefund = new Common().getSalesRefundStatus(orderIds);
			Iterator<Integer> iterator = ordersRefund.keySet().iterator();
			while (iterator.hasNext()) {
				int orderId = iterator.next();
				for(OrderInfo orderInfo : response.getOrderInfoList()){
					if (orderInfo.getOrderId() == orderId) {
						orderInfo.setSalesRefundStatus(ordersRefund.get(orderId));
					}
				}
			}
		}
	}

	@SuppressWarnings("rawtypes")
	private OrderEntities ConvertResult(Sp_GetOrderListByOrderIdList sp) {
		OrderEntities result = new OrderEntities();

		List<Ymt_Order> orders = new ArrayList<Ymt_Order>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_orders())) {
			for (Map m : sp.getYmt_orders()) {
				Ymt_Order order = new Ymt_Order();
				DataUtil.mapToBean(order, m);
				orders.add(order);
			}
		}
		result.setOrders(orders);

		List<Ymt_OrderExt> orderExts = new ArrayList<Ymt_OrderExt>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_orderext())) {
			for (Map m : sp.getYmt_orderext()) {
				Ymt_OrderExt orderExt = new Ymt_OrderExt();
				DataUtil.mapToBean(orderExt, m);
				orderExts.add(orderExt);
			}
		}
		result.setOrderExts(orderExts);

		List<Ymt_O_OrderNote> orderNotes = new ArrayList<Ymt_O_OrderNote>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_o_ordernote())) {
			for (Map m : sp.getYmt_o_ordernote()) {
				Ymt_O_OrderNote orderNote = new Ymt_O_OrderNote();
				DataUtil.mapToBean(orderNote, m);
				orderNotes.add(orderNote);
			}
		}
		result.setOrderNotes(orderNotes);

		List<Ymt_OrderState> orderStates = new ArrayList<Ymt_OrderState>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_orderstate())) {
			for (Map m : sp.getYmt_orderstate()) {
				Ymt_OrderState orderState = new Ymt_OrderState();
				DataUtil.mapToBean(orderState, m);
				orderStates.add(orderState);
			}
		}
		result.setOrderStates(orderStates);

		List<Ymt_OrderPostPay> postPays = new ArrayList<Ymt_OrderPostPay>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_orderpostpay())) {
			for (Map m : sp.getYmt_orderpostpay()) {
				Ymt_OrderPostPay postPay = new Ymt_OrderPostPay();
				DataUtil.mapToBean(postPay, m);
				postPays.add(postPay);
			}
		}
		result.setPostPays(postPays);

		List<Ymt_OrderInfo> orderInfos = new ArrayList<Ymt_OrderInfo>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_orderinfo())) {
			for (Map m : sp.getYmt_orderinfo()) {
				Ymt_OrderInfo orderInfo = new Ymt_OrderInfo();
				DataUtil.mapToBean(orderInfo, m);
				orderInfos.add(orderInfo);
			}
		}
		result.setOrderInfos(orderInfos);

		List<Ymt_OrderSummary> orderSummaries = new ArrayList<Ymt_OrderSummary>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_ordersummary())) {
			for (Map m : sp.getYmt_ordersummary()) {
				Ymt_OrderSummary orderSummarie = new Ymt_OrderSummary();
				DataUtil.mapToBean(orderSummarie, m);
				orderSummaries.add(orderSummarie);
			}
		}
		result.setOrderSummaries(orderSummaries);

		List<Ymt_Order_Frozen> orderFrozens = new ArrayList<Ymt_Order_Frozen>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_order_frozen())) {
			for (Map m : sp.getYmt_order_frozen()) {
				Ymt_Order_Frozen orderFrozen = new Ymt_Order_Frozen();
				DataUtil.mapToBean(orderFrozen, m);
				orderFrozens.add(orderFrozen);
			}
		}
		result.setOrderFrozens(orderFrozens);

		List<Ymt_OrderToBill> orderToBills = new ArrayList<Ymt_OrderToBill>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_ordertobill())) {
			for (Map m : sp.getYmt_ordertobill()) {
				Ymt_OrderToBill orderToBill = new Ymt_OrderToBill();
				DataUtil.mapToBean(orderToBill, m);
				orderToBills.add(orderToBill);
			}
		}
		result.setOrderToBills(orderToBills);

		List<Ymt_Bill> bills = new ArrayList<Ymt_Bill>();
		if (!DataUtil.isNullOrEmpty(sp.getYmt_bill())) {
			for (Map m : sp.getYmt_bill()) {
				Ymt_Bill bill = new Ymt_Bill();
				DataUtil.mapToBean(bill, m);
				bills.add(bill);
			}
		}
		result.setBills(bills);

		List<Ymt_TradingItem> tradingItems = new ArrayList<Ymt_TradingItem>();
		Ymt_TradingItem tradingItem = new Ymt_TradingItem();
		DataUtil.mapToBean(tradingItem, sp.getOrderTradingId());
		tradingItems.add(tradingItem);
		result.setTradingItems(tradingItems);

		List<Ymt_CreditDetail> creditDetails = new ArrayList<Ymt_CreditDetail>();
		result.setCreditDetails(creditDetails);
		return result;
	}

	private void verify() {
		GetOrderListByOrderIdListResponse expectResponse = new GetOrderListByOrderIdListResponse();
		ConstructResponse(expectResponse);
		GetOrderListByOrderIdListResponse actualResponse = call.getOrderListByOrderIdListResponse();
		if (expectResponse.getOrderInfoList() == null) {
			DataUtil.verify(null, actualResponse.getOrderInfoList(), "验证OrderInfoList==null");
		} else {
			DataUtil.verify(expectResponse.getOrderInfoList().size(), actualResponse.getOrderInfoList().size(),
							"验证OrderInfoList.size()");
			boolean equalSize = expectResponse.getOrderInfoList().size() == actualResponse.getOrderInfoList().size();
			if (equalSize) {
				for (int i = 0; i < expectResponse.getOrderInfoList().size(); i++) {
					OrderInfo expect = expectResponse.getOrderInfoList().get(i);
					OrderInfo actual = actualResponse.getOrderInfoList().get(i);
					DataUtil.verify(expect.getOrderId(), actual.getOrderId(), "验证orderid=[" + expect.getOrderId()
									+ "]的OrderId");
					if (expect.getOrderId() == actual.getOrderId()) {
						DataUtil.verifyDateEquals(expect.getAcceptTime(), actual.getAcceptTime(), "验证orderid=["
										+ expect.getOrderId() + "]的AcceptTime");
						DataUtil.verifyDateEquals(expect.getAddress(), actual.getAddress(),
										"验证orderid=[" + expect.getOrderId() + "]的Address");
						DataUtil.verifyDateEquals(expect.getAddTime(), actual.getAddTime(),
										"验证orderid=[" + expect.getOrderId() + "]的AddTime");
						DataUtil.verifyDateEquals(expect.getApplyPostPayTime(), actual.getApplyPostPayTime(),
										"验证orderid=[" + expect.getOrderId() + "]的ApplyPostPayTime");
						DataUtil.verify(expect.getAutoCancelOrderHours(), actual.getAutoCancelOrderHours(),
										"验证orderid=[" + expect.getOrderId() + "]的AutoCancelOrderHours");
						// if ("9999-12-31 23:59:59"
						// .equals(DataUtil.Stringg.getValueOrDefault(expect.getAutoReceiveTime())))
						// {
						// DataUtil.verifyDateEquals(null,
						// actual.getAutoReceiveTime(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的AutoReceiveTime");
						// } else {
						// DataUtil.verifyDateEquals(expect.getAutoReceiveTime(),
						// actual.getAutoReceiveTime(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的AutoReceiveTime");
						// }
						// if (DataUtil.isNullOrEmpty(expect.getBillCodeList()))
						// {
						// DataUtil.verify(true,
						// DataUtil.isNullOrEmpty(actual.getBillCodeList()),
						// "验证orderid=["
						// + expect.getOrderId() +
						// "]的BillCodeList == null或者为空列表");
						// } else {
						// for (String s : expect.getBillCodeList()) {
						// DataUtil.verify(true,
						// actual.getBillCodeList().contains(s),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的BillCodeList列表存在期望值:[" + s
						// + "]");
						// }
						// }
						// DataUtil.verify(expect.getTotalSalesRefundAmount(),
						// actual.getTotalSalesRefundAmount(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的TotalSalesRefundAmount");
						DataUtil.verify(expect.getBillInfoList(), actual.getBillInfoList(),
										"验证orderid=[" + expect.getOrderId() + "]的BillInfoList");
						// DataUtil.verify(expect.getBusynessTypeList(),
						// actual.getBusynessTypeList(), "验证orderid=["
						// + expect.getOrderId() + "]的BusynessTypeList");
						DataUtil.verify(expect.getBuyerId(), actual.getBuyerId(), "验证BuyerId");
						// DataUtil.verify(expect.getBuyerLoginEmail(),
						// actual.getBuyerLoginEmail(), "验证orderid=["
						// + expect.getOrderId() + "]的BuyerLoginEmail");
						DataUtil.verify(expect.getBuyerLoginId(), actual.getBuyerLoginId(),
										"验证orderid=[" + expect.getOrderId() + "]的BuyerLoginId");
						DataUtil.verify(expect.getBuyerNickName(), actual.getBuyerNickName(),
										"验证orderid=[" + expect.getOrderId() + "]的BuyerNickName");
						// DataUtil.verify(expect.getCancelReason(),
						// actual.getCancelReason(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的CancelReason");
						DataUtil.verifyDateEquals(expect.getCancelTime(), actual.getCancelTime(), "验证orderid=["
										+ expect.getOrderId() + "]的CancelTime");
						DataUtil.verifyDateEquals(expect.getChangeAddressTime(), actual.getChangeAddressTime(),
										"验证orderid=[" + expect.getOrderId() + "]的ChangeAddressTime");
						DataUtil.verifyDateEquals(expect.getConfirmedTime(), actual.getConfirmedTime(), "验证orderid=["
										+ expect.getOrderId() + "]的ConfirmedTime");
						DataUtil.verify(expect.getCouponCode(), actual.getCouponCode(),
										"验证orderid=[" + expect.getOrderId() + "]的CouponCode");
						// DataUtil.verify(expect.getCouponType(),
						// actual.getCouponType(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的CouponType");
						DataUtil.verify(DataUtil.BigDecimall.GetValueOrDefault(expect.getCouponValue()),
										DataUtil.BigDecimall.GetValueOrDefault(actual.getCouponValue()), "验证orderid=["
														+ expect.getOrderId() + "]的CouponValue");
						DataUtil.verifyDateEquals(expect.getCreditAddTime(), actual.getCreditAddTime(), "验证orderid=["
										+ expect.getOrderId() + "]的CreditAddTime");
						DataUtil.verify(expect.getCreditDescript(), actual.getCreditDescript(),
										"验证orderid=[" + expect.getOrderId() + "]的CreditDescript");
						DataUtil.verify(expect.getCreditId(), actual.getCreditId(), "验证orderid=[" + expect.getOrderId()
										+ "]的CreditId");
						DataUtil.verify(expect.getCreditSellerReply(), actual.getCreditSellerReply(), "验证orderid=["
										+ expect.getOrderId() + "]的CreditSellerReply");
						DataUtil.verifyDateEquals(expect.getCreditSellerReplyUpdateTime(),
										actual.getCreditSellerReplyUpdateTime(), "验证orderid=[" + expect.getOrderId()
														+ "]的CreditSellerReplyUpdateTime");
						DataUtil.verify(expect.getCreditServiceRange(), actual.getCreditServiceRange(), "验证orderid=["
										+ expect.getOrderId() + "]的CreditServiceRange");
						DataUtil.verify(expect.getCreditUniformityRange(), actual.getCreditUniformityRange(),
										"验证orderid=[" + expect.getOrderId() + "]的CreditUniformityRange");
						DataUtil.verifyDateEquals(expect.getCreditUpdateTime(), actual.getCreditUpdateTime(),
										"验证orderid=[" + expect.getOrderId() + "]的CreditUpdateTime");
						DataUtil.verify(expect.getCreditUserId(), actual.getCreditUserId(),
										"验证orderid=[" + expect.getOrderId() + "]的CreditUserId");
						// DataUtil.verifyDateEquals(expect.getDelayReceiveAddTime(),
						// actual.getDelayReceiveAddTime(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的DelayReceiveAddTime");
						DataUtil.verifyDateEquals(expect.getDelayReceiveFrozenTime(),
										actual.getDelayReceiveFrozenTime(), "验证orderid=[" + expect.getOrderId()
														+ "]的DelayReceiveFrozenTime");
						DataUtil.verifyDateEquals(expect.getDelayReceiveUpdateTime(),
										actual.getDelayReceiveUpdateTime(), "验证orderid=[" + expect.getOrderId()
														+ "]的DelayReceiveUpdateTime");
						DataUtil.verify(expect.getDelayReceiveUserId(), actual.getDelayReceiveUserId(), "验证orderid=["
										+ expect.getOrderId() + "]的DelayReceiveUserId");
						DataUtil.verify(expect.getDiscount(), actual.getDiscount(), "验证orderid=[" + expect.getOrderId()
										+ "]的Discount");
						DataUtil.verifyDateEquals(expect.getDiscountTime(), actual.getDiscountTime(), "验证orderid=["
										+ expect.getOrderId() + "]的DiscountTime");
						DataUtil.verifyDateEquals(expect.getDispatchTime(), actual.getDispatchTime(), "验证orderid=["
										+ expect.getOrderId() + "]的DispatchTime");
						// DataUtil.verify(expect.getDistributor(),
						// actual.getDistributor(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的Distributor");
						// DataUtil.verify(expect.getEmail(), actual.getEmail(),
						// "验证orderid=[" + expect.getOrderId()
						// + "]的Email");
						DataUtil.verify(expect.getFirstPay(), actual.getFirstPay(), "验证orderid=[" + expect.getOrderId()
										+ "]的FirstPay");
						DataUtil.verify(expect.getFreight(), actual.getFreight(), "验证orderid=[" + expect.getOrderId()
										+ "]的Freight");
						DataUtil.verify(expect.getIsMerchant(), actual.getIsMerchant(),
										"验证orderid=[" + expect.getOrderId() + "]的IsMerchant");
						// DataUtil.verify(DataUtil.Booleann.GetValueOrDefault(expect.getIsNewCustomerOrder()),
						// DataUtil.Booleann.GetValueOrDefault(actual.getIsNewCustomerOrder()),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的IsNewCustomerOrder");
						DataUtil.verify(DataUtil.Booleann.GetValueOrDefault(expect.getIsNewSellerOrder()),
										DataUtil.Booleann.GetValueOrDefault(actual.getIsNewSellerOrder()),
										"验证orderid=[" + expect.getOrderId() + "]的IsNewSellerOrder");
						DataUtil.verify(expect.getLeaveWord(), actual.getLeaveWord(),
										"验证orderid=[" + expect.getOrderId() + "]的LeaveWord");
						DataUtil.verifyDateEquals(expect.getLocalRefundApplyTime(), actual.getLocalRefundApplyTime(),
										"验证orderid=[" + expect.getOrderId() + "]的LocalRefundApplyTime");
						DataUtil.verify(expect.getLogisticsType(), actual.getLogisticsType(),
										"验证orderid=[" + expect.getOrderId() + "]的LogisticsType");
						DataUtil.verify(expect.getMainOrderId(), actual.getMainOrderId(),
										"验证orderid=[" + expect.getOrderId() + "]的MainOrderId");
						// DataUtil.verify(expect.getNeedPostPay(),
						// actual.getNeedPostPay(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的NeedPostPay");
						DataUtil.verify(expect.getNeedPrePayAmountOfCash(), actual.getNeedPrePayAmountOfCash(),
										"验证orderid=[" + expect.getOrderId() + "]的NeedPrePayAmountOfCash");
						DataUtil.verify(expect.getOldDiscount(), actual.getOldDiscount(),
										"验证orderid=[" + expect.getOrderId() + "]的OldDiscount");
						DataUtil.verify(expect.getOldFreight(), actual.getOldFreight(),
										"验证orderid=[" + expect.getOrderId() + "]的OldFreight");
						DataUtil.verify(DataUtil.Integerr.GetValueOrDefault(expect.getOperate()),
										DataUtil.Integerr.GetValueOrDefault(actual.getOperate()), "验证orderid=["
														+ expect.getOrderId() + "]的Operate");
						// DataUtil.verifyDateEquals(expect.getOperateExpireTime(),
						// actual.getOperateExpireTime(),
						// "验证orderid=[" + expect.getOrderId() +
						// "]的OperateExpireTime");
						DataUtil.verify(expect.getOrderDiscount(), actual.getOrderDiscount(),
										"验证orderid=[" + expect.getOrderId() + "]的OrderDiscount");
						DataUtil.verify(expect.isPreSaleOrder(), actual.isPreSaleOrder(),
										"验证orderid=[" + expect.getOrderId() + "]的PreSaleOrder");
						DataUtil.verify(expect.getDiscountOfThirdParty(), actual.getDiscountOfThirdParty(),
										"验证orderid=[" + expect.getOrderId() + "]的DiscountOfThirdParty");
						if (expect.getOrderItemList() == null) {
							DataUtil.verify(null, actual.getOrderItemList(), "验证orderid=[" + expect.getOrderId()
											+ "]的OrderItemList==null");
						} else {
							DataUtil.verify(expect.getOrderItemList().size(), actual.getOrderItemList().size(),
											"验证orderid=[" + expect.getOrderId() + "]的OrderItemList.size()");
							boolean goon = expect.getOrderItemList().size() == actual.getOrderItemList().size() ? true
											: false;
							if (goon) {
								for (int j = 0; j < expect.getOrderItemList().size(); j++) {
									OrderItemInfo expectOrderItem = expect.getOrderItemList().get(j);
									OrderItemInfo actualOrderItem = actual.getOrderItemList().get(j);
									verifyOrderItem(expectOrderItem, actualOrderItem, expect.getOrderId());
								}
							}
						}
						DataUtil.verify(expect.getOrderPrice(), actual.getOrderPrice(),
										"验证orderid=[" + expect.getOrderId() + "]的OrderPrice");
						if (expect.getOrderSummaryList() == null) {
							DataUtil.verify(null, actual.getOrderSummaryList(), "验证orderid=[" + expect.getOrderId()
											+ "]的OrderSummaryList==null");
						} else {
							// if
							// (DataUtil.isNullOrEmpty(expect.getOrderSummaryList()))
							// {
							// DataUtil.verify(true,
							// DataUtil.isNullOrEmpty(actual.getOrderSummaryList()),
							// "验证orderid=[" + expect.getOrderId() +
							// "]的OrderSummaryList == null或者空列表");
							// } else {
							// DataUtil.verify(expect.getOrderSummaryList().size(),
							// actual.getOrderSummaryList()
							// .size(), "验证orderid=[" + expect.getOrderId()
							// + "]的OrderSummaryList.size()");
							// boolean goon =
							// expect.getOrderSummaryList().size() ==
							// actual.getOrderSummaryList()
							// .size() ? true : false;
							// if (goon) {
							// for (int j = 0; j <
							// expect.getOrderSummaryList().size(); j++) {
							// OrderSummary expectOrderSummary =
							// expect.getOrderSummaryList().get(j);
							// OrderSummary actualOrderSummary =
							// actual.getOrderSummaryList().get(j);
							// verifyOrderSummary(expectOrderSummary,
							// actualOrderSummary, j);
							// }
							// }
							// }
							DataUtil.verify(DataUtil.Booleann.GetValueOrDefault(expect
											.getPackageDelivery_DomesticDelivered()), DataUtil.Booleann
											.GetValueOrDefault(actual.getPackageDelivery_DomesticDelivered()),
											"验证orderid=[" + expect.getOrderId() + "]的PackageDelivery_DomesticDelivered");
							// DataUtil.verify(expect.getPaidAmountOfCoupon(),
							// actual.getPaidAmountOfCoupon(),
							// "验证orderid=[" + expect.getOrderId() +
							// "]的PaidAmountOfCoupon");
							DataUtil.verify(expect.getPaidAmountOfFreeCard(), actual.getPaidAmountOfFreeCard(),
											"验证orderid=[" + expect.getOrderId() + "]的PaidAmountOfFreeCard");
							DataUtil.verify(expect.getPaidAmountOfYmtCoupon(), actual.getPaidAmountOfYmtCoupon(),
											"验证orderid=[" + expect.getOrderId() + "]的PaidAmountOfYmtCoupon");
							DataUtil.verifyDateEquals(expect.getPaidTime(), actual.getPaidTime(), "验证orderid=["
											+ expect.getOrderId() + "]的PaidTime");
							DataUtil.verify(expect.getPayableAmount(), actual.getPayableAmount(), "验证orderid=["
											+ expect.getOrderId() + "]的PayableAmount");
							DataUtil.verify(expect.getPhone(), actual.getPhone(), "验证orderid=[" + expect.getOrderId()
											+ "]的Phone");
							DataUtil.verify(expect.getPlatformEnum(), actual.getPlatformEnum(),
											"验证orderid=[" + expect.getOrderId() + "]的PlatformEnum");
							DataUtil.verify(expect.getPostCode(), actual.getPostCode(),
											"验证orderid=[" + expect.getOrderId() + "]的PostCode");
							DataUtil.verify(expect.getPostPaidAmountOfCoupon(), actual.getPostPaidAmountOfCoupon(),
											"验证orderid=[" + expect.getOrderId() + "]的PostPaidAmountOfCoupon");
							DataUtil.verify(expect.getPostPaidAmountOfGift(), actual.getPostPaidAmountOfGift(),
											"验证orderid=[" + expect.getOrderId() + "]的PostPaidAmountOfGift");
							DataUtil.verifyDateEquals(expect.getPostPaidTime(), actual.getPostPaidTime(), "验证orderid=["
											+ expect.getOrderId() + "]的PostPaidTime");
							DataUtil.verify(expect.getPromotionReducedAmount(), actual.getPromotionReducedAmount(),
											"验证orderid=[" + expect.getOrderId() + "]的PromotionReducedAmount");
							// DataUtil.verify(expect.getQQ(), actual.getQQ(),
							// "验证orderid=[" + expect.getOrderId() + "]的QQ");
							DataUtil.verify(expect.getRealPaidAmountOfCash(), actual.getRealPaidAmountOfCash(),
											"验证orderid=[" + expect.getOrderId() + "]的RealPaidAmountOfCash");
							DataUtil.verify(expect.getRealPaidAmountOfGift(), actual.getRealPaidAmountOfGift(),
											"验证orderid=[" + expect.getOrderId() + "]的RealPaidAmountOfGift");
							DataUtil.verify(expect.getRealPay(), actual.getRealPay(),
											"验证orderid=[" + expect.getOrderId() + "]的RealPay");
							DataUtil.verify(expect.getRealPostPay(), actual.getRealPostPay(),
											"验证orderid=[" + expect.getOrderId() + "]的RealPostPay");
							// DataUtil.verify(expect.getRealSettlementAmountOfCoupon(),
							// actual.getRealSettlementAmountOfCoupon(),
							// "验证orderid=[" + expect.getOrderId() +
							// "]的RealSettlementAmountOfCoupon");
							DataUtil.verify(expect.getReceivePerson(), actual.getReceivePerson(), "验证orderid=["
											+ expect.getOrderId() + "]的ReceivePerson");
							DataUtil.verify(expect.getRefund(), actual.getRefund(), "验证orderid=[" + expect.getOrderId()
											+ "]的Refund");
							DataUtil.verify(expect.getRemarkLevel(), actual.getRemarkLevel(),
											"验证orderid=[" + expect.getOrderId() + "]的RemarkLevel");
							DataUtil.verify(expect.getReplyTopicWhenOrderPaid(), actual.getReplyTopicWhenOrderPaid(),
											"验证orderid=[" + expect.getOrderId() + "]的ReplyTopicWhenOrderPaid");
							DataUtil.verify(expect.getRiskVerifiedStatus(), actual.getRiskVerifiedStatus(),
											"验证orderid=[" + expect.getOrderId() + "]的RiskVerifiedStatus");
							if (DataUtil.Integerr.GetValueOrDefault(expect.getSalesRefundStatus()) == 1) { // 订单退款状态为1时需要验证下，其他状态没有卵用
								DataUtil.verify(expect.getSalesRefundStatus(), actual.getSalesRefundStatus(),
												"验证orderid=[" + expect.getOrderId() + "]的SalesRefundStatus");
							}
							DataUtil.verify(expect.getSellerCouponAmount(), actual.getSellerCouponAmount(),
											"验证orderid=[" + expect.getOrderId() + "]的SellerCouponAmount");
							DataUtil.verify(expect.getSellerCouponCode(), actual.getSellerCouponCode(), "验证orderid=["
											+ expect.getOrderId() + "]的SellerCouponCode");
							// DataUtil.verify(expect.getSellerLoginEmail(),
							// actual.getSellerLoginEmail(), "验证orderid=["
							// + expect.getOrderId() + "]的SellerLoginEmail");
							DataUtil.verify(expect.getSellerLoginId(), actual.getSellerLoginId(), "验证orderid=["
											+ expect.getOrderId() + "]的SellerLoginId");
							DataUtil.verify(expect.getSellerNote(), actual.getSellerNote(),
											"验证orderid=[" + expect.getOrderId() + "]的SellerNote");
							DataUtil.verify(expect.getStockStatus(), actual.getStockStatus(),
											"验证orderid=[" + expect.getOrderId() + "]的StockStatus");
							// DataUtil.verify(expect.getUnfreezeStatus(),
							// actual.getUnfreezeStatus(), "验证orderid=["
							// + expect.getOrderId() + "]的UnfreezeStatus");
							DataUtil.verify(expect.getUseFreeCardAmount(), actual.getUseFreeCardAmount(), "验证orderid=["
											+ expect.getOrderId() + "]的UseFreeCardAmount");
							DataUtil.verify(expect.getUseGiftAmount(), actual.getUseGiftAmount(), "验证orderid=["
											+ expect.getOrderId() + "]的UseGiftAmount");
							DataUtil.verify(expect.getUserId(), actual.getUserId(), "验证orderid=[" + expect.getOrderId()
											+ "]的UserId");
							DataUtil.verify(expect.getYmtCouponAmount(), actual.getYmtCouponAmount(), "验证orderid=["
											+ expect.getOrderId() + "]的YmtCouponAmount");
							DataUtil.verify(expect.getYmtCouponCode(), actual.getYmtCouponCode(), "验证orderid=["
											+ expect.getOrderId() + "]的YmtCouponCode");
							DataUtil.verify(expect.isCredited(), actual.isCredited(),
											"验证orderid=[" + expect.getOrderId() + "]的Credited");
							DataUtil.verify(expect.isDelayReceiveFrozened(), actual.isDelayReceiveFrozened(),
											"验证orderid=[" + expect.getOrderId() + "]的DelayReceiveFrozened");
							DataUtil.verify(expect.isFrozen(), actual.isFrozen(), "验证orderid=[" + expect.getOrderId()
											+ "]的Frozen");
							DataUtil.verify(expect.isHaveUploadedIdCard(), actual.isHaveUploadedIdCard(), "验证orderid=["
											+ expect.getOrderId() + "]的HaveUploadedIdCard");
							DataUtil.verify(expect.isHaveUploadedIdCard(), actual.isHaveUploadedIdCard(), "验证orderid=["
											+ expect.getOrderId() + "]的HaveUploadedIdCard");
							DataUtil.verify(expect.isIsAutoReceiveEnabled(), actual.isIsAutoReceiveEnabled(),
											"验证orderid=[" + expect.getOrderId() + "]的IsAutoReceiveEnabled");
							DataUtil.verify(expect.isIsShippedByXlobo(), actual.isIsShippedByXlobo(), "验证orderid=["
											+ expect.getOrderId() + "]的IsShippedByXlobo");
							DataUtil.verify(expect.isNeedUploadIdCard(), actual.isNeedUploadIdCard(), "验证orderid=["
											+ expect.getOrderId() + "]的NeedUploadIdCard");
							// DataUtil.verify(expect.isPaidInFull(),
							// actual.isPaidInFull(),
							// "验证orderid=[" + expect.getOrderId() +
							// "]的PaidInFull");
							// DataUtil.verify(expect.isShangouOrder(),
							// actual.isShangouOrder(),
							// "验证orderid=[" + expect.getOrderId() +
							// "]的ShangouOrder");
							// DataUtil.verify(expect.isSupportLocalRefund(),
							// actual.isSupportLocalRefund(), "验证orderid=["
							// + expect.getOrderId() + "]的SupportLocalRefund");
						}
					}
				}
			}
		}

	}

	@Deprecated
	private void verifyOrderSummary(OrderSummary expect, OrderSummary actual, int index) {
		DataUtil.verify(expect.getBillType(), actual.getBillType(), "验证OrderSummaryList[" + index + "].的BillType");
		DataUtil.verify(expect.getSummary(), actual.getSummary(), "验证OrderSummaryList[" + index + "].的Summary");
	}

	private void verifyOrderItem(OrderItemInfo expect, OrderItemInfo actual, int orderid) {
		String expId = expect.getOrderItemId();
		String actId = actual.getOrderItemId();
		DataUtil.verify(expId, actId, "验证orderid=[" + orderid + "]的OrderItemId");
		boolean goon = expId.equals(actId) ? true : false;
		if (goon) {
			DataUtil.verify(expect.isPreSale(), actual.isPreSale(), "验证orderid=[" + orderid
							+ "]的PreSale");
			DataUtil.verify(expect.isPspProduct(), actual.isPspProduct(), "验证orderid=[" + orderid
							+ "]的OrderItemList.PspProduct");
			DataUtil.verify(DataUtil.BigDecimall.GetValueOrDefault(expect.getThirdPartyDiscount()),
							actual.getThirdPartyDiscount(), "验证OrderItemList.OrderItemId=[" + expId
											+ "]的ThirdPartyDiscount");
			DataUtil.verify(expect.getAmount(), actual.getAmount(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的Amount");
			DataUtil.verify(expect.getBondedArea(), actual.getBondedArea(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的BondedArea");
			DataUtil.verify(expect.getCatalogId(), actual.getCatalogId(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的CatalogId");
			DataUtil.verify(expect.getCatalogId(), actual.getCatalogId(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的CatalogId");
			DataUtil.verify(expect.getDescription(), actual.getDescription(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的Description");
			DataUtil.verify(expect.getDiscount(), actual.getDiscount(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的Discount");
			DataUtil.verify(expect.getFreight(), actual.getFreight(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的Freight");
			// DataUtil.verify(expect.getFreightFree(), actual.getFreightFree(),
			// "验证OrderItemList.OrderItemId=[" + expId
			// + "]的FreightFree");
			DataUtil.verify(expect.getItemType(), actual.getItemType(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的ItemType");
			DataUtil.verify(expect.getLogisticsType(), actual.getLogisticsType(), "验证OrderItemList.OrderItemId=["
							+ expId + "]的LogisticsType");
			if (null == expect.getOrderItemInfoExt()) {
				DataUtil.verify(null, actual.getOrderItemInfoExt(), "验证OrderItemList.OrderItemId=[" + expId
								+ "]的OrderItemInfoExt == null");
			} else {
				verifyOrderItemInfoExt(expect.getOrderItemInfoExt(), actual.getOrderItemInfoExt(), expId);
			}
			OrderItemInfoExt expExt = expect.getOrderItemInfoExt();
			OrderItemInfoExt actExt = actual.getOrderItemInfoExt();
			if (expExt == null) {
				DataUtil.verify(expect.getOrderItemInfoExt(), actual.getOrderItemInfoExt(),
								"验证OrderItemList.OrderItemId=[" + expId + "]的OrderItemInfoExt==null");
			} else {
				DataUtil.verify(expExt.getActivityId(), actExt.getActivityId(), "验证OrderItemList.OrderItemId=[" + expId
								+ "]的OrderItemInfoExt.ActivityId");
				DataUtil.verify(expExt.getActivityTemplateId(), actExt.getActivityTemplateId(),
								"验证OrderItemList.OrderItemId=[" + expId + "]的OrderItemInfoExt.ActivityTemplateId");
				DataUtil.verify(expExt.getGiftAvail4Reward(), actExt.getGiftAvail4Reward(),
								"验证OrderItemList.OrderItemId=[" + expId + "]的OrderItemInfoExt.GiftAvail4Reward");
			}
			DataUtil.verify(expect.getPictureUrl(), actual.getPictureUrl(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的PictureUrl");
			DataUtil.verify(expect.getPremium(), actual.getPremium(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的Premium");
			DataUtil.verify(expect.getPrice(), actual.getPrice(), "验证OrderItemList.OrderItemId=[" + expId + "]的Price");
			DataUtil.verify(expect.getPriceType(), actual.getPriceType(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的PriceType");
			DataUtil.verify(expect.getProductId(), actual.getProductId(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的ProductId");
			DataUtil.verify(expect.getProductOriginalPrice(), actual.getProductOriginalPrice(),
							"验证OrderItemList.OrderItemId=[" + expId + "]的ProductOriginalPrice");
			DataUtil.verify(expect.getProductPrice(), actual.getProductPrice(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的ProductPrice");
			DataUtil.verify(expect.getProductRefundChannel(), actual.getProductRefundChannel(),
							"验证OrderItemList.OrderItemId=[" + expId + "]的ProductRefundChannel");
			DataUtil.verify(expect.getPropertyInfo(), actual.getPropertyInfo(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的PropertyInfo");
			ProductPromotion expPro = expect.getPromotion();
			ProductPromotion actPro = actual.getPromotion();
			if (expPro == null) {
				DataUtil.verify(null, actPro, "验证OrderItemList.OrderItemId=[" + expId + "]的Promotion==null");
			} else {
				DataUtil.verify(expPro.getCondition(), actPro.getCondition(), "验证OrderItemList.OrderItemId=[" + expId
								+ "]的Promotion.Condition");
				DataUtil.verify(expPro.getContent(), actPro.getContent(), "验证OrderItemList.OrderItemId=[" + expId
								+ "]的Promotion.Content");
				DataUtil.verify(expPro.getID(), actPro.getID(), "验证OrderItemList.OrderItemId=[" + expId
								+ "]的Promotion.ID");
				DataUtil.verify(expPro.getName(), actPro.getName(), "验证OrderItemList.OrderItemId=[" + expId
								+ "]的Promotion.Name");
				DataUtil.verify(expPro.getPartialReducedAmount(), actPro.getPartialReducedAmount(),
								"验证OrderItemList.OrderItemId=[" + expId + "]的Promotion.PartialReducedAmount");
				DataUtil.verify(expPro.getReducedAmount(), actPro.getReducedAmount(), "验证OrderItemList.OrderItemId=["
								+ expId + "]的Promotion.ReducedAmount");
				DataUtil.verify(expPro.getType(), actPro.getType(), "验证OrderItemList.OrderItemId=[" + expId
								+ "]的Promotion.Type");
			}
			DataUtil.verify(expect.getReferenceUrl(), actual.getReferenceUrl(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的ReferenceUrl");
			// DataUtil.verify(expect.getRefundBillNo(),
			// actual.getRefundBillNo(), "验证OrderItemList.OrderItemId=[" + expId
			// + "]的RefundBillNo");
			// DataUtil.verify(expect.getSalesType(), actual.getSalesType(),
			// "验证OrderItemList.OrderItemId=[" + expId
			// + "]的SalesType");
			DataUtil.verify(expect.getSellerCouponAmount(), actual.getSellerCouponAmount(),
							"验证OrderItemList.OrderItemId=[" + expId + "]的SellerCouponAmount");
			DataUtil.verify(expect.getSku(), actual.getSku(), "验证OrderItemList.OrderItemId=[" + expId + "]的Sku");
			DataUtil.verify(expect.getStockStatus(), actual.getStockStatus(), "验证OrderItemList.OrderItemId=[" + expId
							+ "]的StockStatus");
			DataUtil.verify(expect.getSubProductCategoryId(), actual.getSubProductCategoryId(),
							"验证OrderItemList.OrderItemId=[" + expId + "]的SubProductCategoryId");
			// DataUtil.verify(expect.getTariffType(), actual.getTariffType(),
			// "验证OrderItemList.OrderItemId=[" + expId
			// + "]的TariffType");
			DataUtil.verify(expect.getTitle(), actual.getTitle(), "验证OrderItemList.OrderItemId=[" + expId + "]的Title");
			DataUtil.verify(expect.getYmtCouponAmount(), actual.getYmtCouponAmount(), "验证OrderItemList.OrderItemId=["
							+ expId + "]的YmtCouponAmount");
		}
	}

	private void verifyOrderItemInfoExt(OrderItemInfoExt expect, OrderItemInfoExt actual, String oid) {
		DataUtil.verify(expect.getActivityId(), actual.getActivityId(), "验证OrderItemList.OrderItemId=[" + oid
						+ "]的OrderItemInfoExt.ActivityId");
		DataUtil.verify(expect.getActivityTemplateId(), actual.getActivityTemplateId(), "验证OrderItemList.OrderItemId=["
						+ oid + "]的OrderItemInfoExt.ActivityTemplateId");
		DataUtil.verify(expect.getGiftAvail4Reward(), actual.getGiftAvail4Reward(), "验证OrderItemList.OrderItemId=["
						+ oid + "]的OrderItemInfoExt.GiftAvail4Reward");
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderListByOrderIdList_001() {
		Logger.start(true, "根据订单id列表获取订单列表成功");
		try {
			Logger.comment("准备订单数据");
			// 创建订单
			OrderCreate o = new OrderCreate();
			int sellerId = (Integer) Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = (Integer) Integer.valueOf(EnvSetup.getData("BuyUserId"));

			ArrayList<Integer> list = new ArrayList<Integer>();
			list.add(o.create1_M2cOrder(userId, sellerId).getiOrderId());
			list.add(o.create2_PayOrder(userId, sellerId).getiOrderId());
			list.add(o.create3_ShippedOrder(userId, sellerId).getiOrderId());
			list.add(o.create4_ReceivedOrder(userId, sellerId).getiOrderId());
			list.add(o.create4_RefundOrder(userId, sellerId).getiOrderId());
			list.add(o.create17_AcceptOrder(userId, sellerId).getiOrderId());
			list.add(o.create12_UserCancelOrder(userId, sellerId).getiOrderId());
			list.add(o.createOrderWithSellerCoupon(userId, sellerId).getiOrderId());
			Thread.sleep(2000l);
			Logger.comment("完成准备订单数据");
			// 参数
			request.setOrderIdList(list);
			request.setSellerId(sellerId);

			// 发送请求
			call.setData(request);
			call.callService();
			Logger.verifyEquals(ECode.SUCCESS, call.getCode(), "验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	@Ignore
	public void Tc_GetOrderListByOrderIdList_002() {
		Logger.start(true, "不传sellerid");
		try {
			OrderCreate o = new OrderCreate();
			int sellerId = (Integer) Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = (Integer) Integer.valueOf(EnvSetup.getData("BuyUserId"));

			ArrayList<Integer> list = new ArrayList<Integer>();
			list.add(o.create1_M2cOrder(userId, sellerId).getiOrderId());
			Thread.sleep(2000l);

			// 参数
			request.setOrderIdList(list);

			// 发送请求
			call.setData(request);
			call.callService();
			Logger.verifyEquals(ECode.SUCCESS, call.getCode(), "验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetOrderListByOrderIdList_004() {
		Logger.start(true, "不传OrderIdList");
		try {
			int sellerId = (Integer) Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setSellerId(sellerId);

			// 发送请求
			call.setData(request);
			call.callService();
			Logger.verifyEquals(ECode.ERROR400, call.getCode(), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetOrderListByOrderIdList_005() {
		Logger.start(true, "OrderIdList.size==0");
		try {
			int sellerId = (Integer) Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setOrderIdList(new ArrayList<Integer>());
			request.setSellerId(sellerId);

			// 发送请求
			call.setData(request);
			call.callService();
			Logger.verifyEquals(ECode.ERROR400, call.getCode(), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetOrderListByOrderIdList_006() {
		Logger.start(true, "sellerid不存在");
		try {
			// 创建订单
			ArrayList<Integer> list = new ArrayList<Integer>();
			OrderCreate o = new OrderCreate();
			int sellerId = (Integer) Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = (Integer) Integer.valueOf(EnvSetup.getData("BuyUserId"));

			list.add(o.create1_M2cOrder(userId, sellerId).getiOrderId());
			Thread.sleep(2000l);
			// 参数
			request.setOrderIdList(list);
			request.setSellerId(404);

			// 发送请求
			call.setData(request);
			call.callService();
			Logger.verifyEquals(ECode.SUCCESS, call.getCode(), "验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetOrderListByOrderIdList_007() {
		Logger.start(true, "orderid不存在");
		try {
			// 创建订单
			ArrayList<Integer> list = new ArrayList<Integer>();
			list.add(994236489);
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 参数
			request.setOrderIdList(list);
			request.setSellerId(sellerId);

			// 发送请求
			call.setData(request);
			call.callService();
			Logger.verifyEquals(ECode.SUCCESS, call.getCode(), "验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	

}
